package com.esun.payment_api.domain;

import com.esun.common.utils.SecurityUtils;
import com.esun.payment_api.security.model.LoginBody;
import com.esun.payment_api.security.model.RegisterBody;

import java.io.Serializable;
import java.util.Date;

public class User implements Serializable {
    private Short id;

    private String uuid;

    private Short coId;

    private Short deptId;

    private String loginName;

    private String password;

    private String pwdAlg;

    private String pwdSalt;

    private String userName;

    private String phone;

    private String photo;

    private String email;

    private String status;

    private String roleStr;

    private Date lastLoginTime;

    private String lastLoginIp;

    private Date pwdSetAt;

    private Short pwdErrTimes;

    private Date lockAt;

    private String userType;

    private Date createAt;

    private Short createBy;

    private Date updateAt;

    private Short updateBy;

    private Date deleteAt;

    private Short deleteBy;

    private String remarks;

    private String isDeleted;

    private String wxOpenId;

    private String wxUnionId;

    //是否需要修改密码:0-否，1-是, 默认1
    private String isUpdatePwd;

    public Short getId() {
        return id;
    }

    public void setId(Short id) {
        this.id = id;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid == null ? null : uuid.trim();
    }

    public Short getCoId() {
        return coId;
    }

    public void setCoId(Short coId) {
        this.coId = coId;
    }

    public Short getDeptId() {
        return deptId;
    }

    public void setDeptId(Short deptId) {
        this.deptId = deptId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName == null ? null : loginName.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getPwdAlg() {
        return pwdAlg;
    }

    public void setPwdAlg(String pwdAlg) {
        this.pwdAlg = pwdAlg == null ? null : pwdAlg.trim();
    }

    public String getPwdSalt() {
        return pwdSalt;
    }

    public void setPwdSalt(String pwdSalt) {
        this.pwdSalt = pwdSalt == null ? null : pwdSalt.trim();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo == null ? null : photo.trim();
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getRoleStr() {
        return roleStr;
    }

    public void setRoleStr(String roleStr) {
        this.roleStr = roleStr == null ? null : roleStr.trim();
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp == null ? null : lastLoginIp.trim();
    }

    public Date getPwdSetAt() {
        return pwdSetAt;
    }

    public void setPwdSetAt(Date pwdSetAt) {
        this.pwdSetAt = pwdSetAt;
    }

    public Short getPwdErrTimes() {
        return pwdErrTimes;
    }

    public void setPwdErrTimes(Short pwdErrTimes) {
        this.pwdErrTimes = pwdErrTimes;
    }

    public Date getLockAt() {
        return lockAt;
    }

    public void setLockAt(Date lockAt) {
        this.lockAt = lockAt;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType == null ? null : userType.trim();
    }

    public Date getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }

    public Date getDeleteAt() {
        return deleteAt;
    }

    public void setDeleteAt(Date deleteAt) {
        this.deleteAt = deleteAt;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks == null ? null : remarks.trim();
    }

    public String getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(String isDeleted) {
        this.isDeleted = isDeleted == null ? null : isDeleted.trim();
    }

    public Short getCreateBy() {
        return createBy;
    }

    public void setCreateBy(Short createBy) {
        this.createBy = createBy;
    }

    public Short getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(Short updateBy) {
        this.updateBy = updateBy;
    }

    public Short getDeleteBy() {
        return deleteBy;
    }

    public void setDeleteBy(Short deleteBy) {
        this.deleteBy = deleteBy;
    }

    public String getWxOpenId() {
        return wxOpenId;
    }

    public void setWxOpenId(String wxOpenId) {
        this.wxOpenId = wxOpenId;
    }

    public String getWxUnionId() {
        return wxUnionId;
    }

    public void setWxUnionId(String wxUnionId) {
        this.wxUnionId = wxUnionId;
    }

    public String getIsUpdatePwd() {
        return isUpdatePwd;
    }

    public void setIsUpdatePwd(String isUpdatePwd) {
        this.isUpdatePwd = isUpdatePwd == null ? null : isUpdatePwd.trim();
    }

    public User(){

    }

    public User(RegisterBody registerBody){
        this.loginName = registerBody.getLoginName();
        this.userName = registerBody.getUsername();
        this.password = SecurityUtils.encryptPassword(registerBody.getPassword());
        this.remarks = registerBody.getRemarks();
        this.coId = registerBody.getCompanyId();
        this.deptId = registerBody.getDepartmentId();
        this.roleStr = registerBody.getRoleStr();

        this.isDeleted ="0";
    }
}